package net.wanho.systemSettings.dao.impl;

import net.wanho.commons.dao.impl.BaseDAOImpl;
import net.wanho.commons.exception.DAOException;
import net.wanho.commons.exception.DataAccessException;
import net.wanho.systemSettings.dao.DepartmentDAO;
import net.wanho.systemSettings.po.Department;

import java.util.List;

public class DepartmentDAOImpl extends BaseDAOImpl<Department> implements DepartmentDAO {
    @Override
    public List<Department> selectAll() throws DAOException {
        try {
            String sql = "select\n" +
                    " DEPARTMENT_ID departmentId,\n" +
                    " DEPARTMENT_NAME departmentName\n" +
                    " from\n" +
                    " department\n";
            Object [] params = {};
            return super.queryForList(sql,params);
        } catch (DataAccessException e) {
            e.printStackTrace();
            throw new DAOException(e.getMessage());
        }
    }
}
